<!--# layout("/common/leftmallout.html",{"jsBase":"/js/user/subMerchant/"}){ -->
<link rel="stylesheet" href="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/member.css">
<script src="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/Validform_v5.3.2.js"></script>
<div class="center">
	<div class="section">
    	<!-------------面包屑--------------------->
            <div class="bread-crumbs">
                 <br/>
                </div>
        <!------------------主体结构--------------------->
        <div class="small-page">
         <!--左侧-->
        	
       <!-------左侧end-------->
       <!-------右侧-------->
            <div class="page-article">
            	<div class="area_mend_head">
                    <span> 已授权子公司明细</span>
			                    <!-- 注意事项 -->
			           <div class="attention">
			               <div class="attention_center">
			                   <a href="/user/subMerchant/showMainMerchantInfo.do" class="invite add_SubMerchant">邀请子公司</a>
			               </div>
			           </div>
                </div>
                
                <div class="area_mend_body">
                    <!-- 选择状态 -->

			           
                
                	<table class="area_mood_tanle">
                		 <div style="width: 100% ;height: 45px" class="kind">
			                    <span>入驻状态：</span>
			                    <select name="sellerStatus" class="sellerTypeStatus" id="sellerTypeStatus1">
			                        <option value="all">全部</option>
			                    </select>
			                	
			                    <span>商家类型：</span>
			                    <select name="sellerTypeStatus" class="sellerTypeStatus" id="sellerTypeStatus2">
			                        <option value="all">合作商</option>
			                    </select>

			                    <span>公司账户名称：</span>
			                    <select name="sellerNameStatus" class="sellerTypeStatus" id="sellerTypeStatus3">
			                        <option value="all">全部</option>
			                    </select>			        
			            </div>
                	
                    	<thead>
                        	<tr>
                            	<td width="35%">公司账户名称</td>
                                <td width="17%">商家类型</td>
                                <td width="16%">状态</td>
                                <td width="16%">创建人</td>
                                <td width="16%">创建时间</td>                              
                            </tr>
                        </thead>
                        <tbody class="tbodySubMerchant">
                        </tbody>
                    </table>
                   	
                    <!----------------------->	
                </div>
            </div>
       <!-------右侧end-------->
        </div>
        <!------------------->
    </div>
</div>
<!--#} -->

 <script>
layui.use(['index'], function(){
    var popAddSubMerchantIndex = layui.index
    popAddSubMerchantIndex.init();
});

$('#subMerchant').css({'color':'#6647b2','font-weight':'900'});
</script>

<script >

	
	doAjax('/user/subMerchant/showMainMerchantInfo.json','get','',function(res){
		$('.tbodySubMerchant').empty();
		var html="";
		html+='<tr style="display:none">'+
		      '<td><span id="curr_mainSellerId">'+res.data.mainSellerId+'</span></td>'+'</tr>';
		$('.tbodySubMerchant').append(html);
		    
				
	});
	
	
	
	
    var sellerState = $("#sellerTypeStatus1").val();
    var sellerType = $("#sellerTypeStatus2").val();
    var sellerName = $("#sellerTypeStatus3").val();
    var subSellerParam={
    		"sellerState":sellerState,
    		"sellerType":sellerType,
    		"sellerName":sellerName
    }
    doAjax('/user/subMerchant/getSubMerchantList.json','post',{"subSellerParam":JSON.stringify(subSellerParam)},function(res){
        
        var html="";
        for(var i=0;i<res.data.sellerVOList.length;i++){
        	var subSellerList=res.data.sellerVOList[i];
        	//商户类型
        	if(subSellerList.sellerType == 0){
        		subSellerList.sellerType = '供应商';
        	}else if(subSellerList.sellerType == 1){
        		subSellerList.sellerType = '工厂';
        	}else if(subSellerList.sellerType == 2){
        		subSellerList.sellerType = '供应商和工厂';
        	}
        	//
        	if(subSellerList.sellerState == 0){
        		subSellerList.sellerState = '未申请';
        	}else if(subSellerList.sellerState == 1){
        		subSellerList.sellerState = '待审核';
        	}else if(subSellerList.sellerState == 2){
        		subSellerList.sellerState = '驳回';
        	}else if(subSellerList.sellerState == 3){
        		subSellerList.sellerState = '已通过';
        	}
        	if(!subSellerList.name){
        		subSellerList.name="无";
        	}
        	
        	html+='<tr>'+
			        	'<td ><span>'+subSellerList.sellerName+'</span></td>'+
			            '<td ><span>'+subSellerList.sellerType+'</span></td>'+
			            '<td ><span>'+subSellerList.sellerState+'</span></td>'+
			            '<td ><span>'+subSellerList.name+'</span></td>'+
			            '<td ><span>'+subSellerList.createtime+'</span></td>'
			            ;
	            
				
        }
        $('.tbodySubMerchant').append(html);
              
    },'');
	



	var html=$('.page-aside');
	var righthtml=$('.page-article');
	$('.small-page').empty();
	$('.small-page').append(html);
	$('.small-page').append(righthtml);

</script>
	
<style>
	.sellerTypeStatus {
		border: 1px solid #000;
		vertical-align: top;
	}
	.kind span {
		    margin-left: 30px;
	}
	
	.kind span:nth-child(1) {
		    margin-left: 0;
	}
</style>
    